

#include <Windows.h>
#include <conio.h>  
#include <fcntl.h>  
#include <io.h> 
#include <stdio.h>
#include "console.h"

namespace mdkl{
console::console(void)
{
	AllocConsole(); 
	int hCrun;     
	hCrun = _open_osfhandle((long )GetStdHandle(STD_OUTPUT_HANDLE), _O_TEXT); 
	FILE* hFile  = _fdopen(hCrun, "w" ); 
	// use default stream buffer 
	setvbuf(hFile, NULL, _IONBF, 0); 
	*stdout = *hFile;  
}

console::~console(void)
{
	FreeConsole(); 
}

}//end of namespace mdkl